<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags"%>
<%@ taglib prefix="fns" uri="/WEB-INF/tlds/fns.tld"%>

<c:set var="ctx" value="${pageContext.request.contextPath}" />

<h4>${empty office.id? "新组织机构":"组织机构"  }</h4>
<div class="error alert alert-danger" style="display:none;">
</div>
<form id="office-form" class="form-horizontal" style="padding: 15px;">
    <input type="hidden" name="id" value="${office.id }"/>
    <input type="hidden" name="delFlag" value="${office.delFlag }"/>
	<div class="form-group">
        <label for="name" class="col-sm-2 control-label"><span class="text-fill">*</span>名称</label>
        <div class="col-sm-3">
            <input type="text" class="form-control input-sm required" id="name" name="name"  value="${office.name }"  title="名称必须填写">
        </div>
	</div>
    <div class="form-group">
        <label  class="col-sm-2 control-label"><span class="text-fill">*</span>类型</label>
        <div class="col-sm-3">
            <c:forEach items="${fns:getDictList('office_type')}" var="dict">
                <input type="radio" name="type" value="${dict.value}" ${office.type == dict.value?"checked":""}> ${dict.label}
            </c:forEach>
        </div>
    </div>

    <div class="form-group">
        <label  class="col-sm-2 control-label"><span class="text-fill">*</span>等级</label>
        <div class="col-sm-3">
            <c:forEach items="${fns:getDictList('office_grade')}" var="dict">
                <input type="radio" name="grade" value="${dict.value}" ${office.grade == dict.value?"checked":""}> ${dict.label}
            </c:forEach>
        </div>
    </div>
    <div class="form-group">
        <label for="parent.id" class="col-sm-2 control-label"><span class="text-fill">*</span>父级编号</label>
        <div class="col-sm-3">
            <input type="text" class="form-control input-sm" id="parent.id" name="parent.id" value="${office.parent.id }" title="父级必须填写">
        </div>
    </div>

    <div class="form-group">
        <label for="code" class="col-sm-2 control-label">班级编号</label>
        <div class="col-sm-3">
            <input type="text" placeholder="班级才填写" class="form-control input-sm" id="code" name="code" value="${office.code }">
        </div>
    </div>

    <div class="form-group">
        <label for="address" class="col-sm-2 control-label">联系地址</label>
        <div class="col-sm-3">
            <input type="text" class="form-control input-sm" id="address" name="address" value="${office.address }">
        </div>
    </div>

    <div class="form-group">
        <label for="master" class="col-sm-2 control-label">负责人</label>
        <div class="col-sm-3">
            <input type="text" class="form-control input-sm" id="master" name="master.id" value="${office.master.id }">
        </div>
    </div>
    <div class="form-group">
        <label for="phone" class="col-sm-2 control-label">手机号</label>
        <div class="col-sm-3">
            <input type="text" class="form-control input-sm" id="phone" name="phone" value="${office.phone }">
        </div>
    </div>

    <div class="form-group">
        <label for="fax" class="col-sm-2 control-label">传真</label>
        <div class="col-sm-3">
            <input type="text" class="form-control input-sm" id="fax" name="fax" value="${office.fax }">
        </div>
    </div>
    <div class="form-group">
        <label for="remark" class="col-sm-2 control-label">备注</label>
        <div class="col-sm-3">
            <textarea class="form-control input-sm" id="remark" name="remark" value="${office.remark }"></textarea>
        </div>
    </div>
</form>

<div >
	<shiro:hasPermission name="sys:menu:edit">
		<button id="office-submit" class="btn btn-primary btn-sm" type="button">保 存</button>
	</shiro:hasPermission>
		<button id="office-cancel" class="btn btn-sm" type="button" onclick="history.go(-1)">返 回</button>
</div>

<script type="text/javascript">
    <c:if test="${env == 'pro' }">
    requirejs(['${ctx}/assets/js/app/admin/office-form-page.js']);
    </c:if>
    <c:if test="${env != 'pro' }">
    requirejs(['${ctx}/assets/js/app/admin/office-form-page.js']);
    </c:if>
</script>
